<template>
  <section class="hero card">
    <div class="hero__content">
      <div class="hero__left">
        <h1>面向工业采购的全流程商城</h1>
        <p>
          平台整合多仓库存与标准化商品数据，为采购团队提供快速找货、核实、下单、结算的一站式体验，保证价格透明、履约可追溯。
        </p>
        <div class="hero__actions">
          <button class="btn btn--primary" @click="$emit('scroll-search')">
            立即找货
          </button>
          <button class="btn btn--ghost" @click="$emit('view-solutions')">
            了解供应链方案
          </button>
        </div>
      </div>
      <div class="hero__right">
        <div
          v-for="item in ads"
          :key="item.id"
          class="hero__banner"
          :style="{ backgroundImage: item.gradient }"
        >
          <span class="banner__tag">重点推荐</span>
          <h3>{{ item.title }}</h3>
          <p>{{ item.description }}</p>
          <a href="#contact" class="banner__cta">{{ item.cta }} →</a>
        </div>
      </div>
    </div>
  </section>
</template>

<script setup>
defineProps({
  ads: {
    type: Array,
    default: () => []
  }
});
</script>

<style scoped lang="scss">
.hero {
  padding: 36px;
  margin-top: 24px;
  background: url("https://images.unsplash.com/photo-1455165814004-1126a7199f9b?auto=format&fit=crop&w=1400&q=80")
    no-repeat center right / cover;
  position: relative;
  overflow: hidden;
  min-height: 320px;
  color: #fff;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(0, 34, 80, 0.86) 0%, rgba(0, 82, 217, 0.72) 60%, rgba(0, 82, 217, 0.35) 100%);
  z-index: 0;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 28px;
  align-items: stretch;
}

.hero__left {
  flex: 1 0 45%;
  display: flex;
  flex-direction: column;
  gap: 16px;

  h1 {
    font-size: 34px;
    margin: 0;
  }

  p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
  }
}

.hero__actions {
  margin-top: 16px;
  display: flex;
  gap: 16px;
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 10px 24px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  &--primary {
    background: #fff;
    color: var(--primary-color);

    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 12px 24px rgba(0, 82, 217, 0.2);
    }
  }

  &--ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);

    &:hover {
      background: rgba(255, 255, 255, 0.2);
    }
  }
}

.hero__right {
  flex: 1 0 45%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.hero__banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 16px;
  background-size: cover;
  color: #fff;
  min-height: 160px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.banner__tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.banner__cta {
  font-weight: 600;
  margin-top: auto;
  color: rgba(255, 255, 255, 0.95);

  &:hover {
    text-decoration: underline;
  }
}

@media (max-width: 960px) {
  .hero {
    padding: 24px;
  }

  .hero__content {
    flex-direction: column;
  }
}
</style>
